package com.adb.util;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;

import com.jjmmbb.jxSudoku.Comm;

public class NetUtil {

	public static String getUpdateInfo(String urlStr) {
		Comm.print("getUpdateInfo_url: " + urlStr);
		try {
			URL url = new URL(urlStr);
			URLConnection connection;
			connection = url.openConnection();
			InputStream is = (InputStream) connection.getContent();
			BufferedReader reader = new BufferedReader(
					new InputStreamReader(is));
			String tmp = "";
			while ((tmp = reader.readLine()) != null) {
				Comm.updateInfoList.add(tmp);
			}
			if (Comm.updateInfoList != null && Comm.updateInfoList.size() > 0) {
				return Comm.updateInfoList.get(0);
			} else {
				return "";
			}
		} catch (Exception e) {
			Comm.print(e.toString());
		}
		return "";
	}
}
